<html>
    
<head>
 <title>EasyRTC Client JsDocs</title>
 <link rel="stylesheet" type="text/css" href="jsdoc/styles/jsdoc-client.css" />

</head>

<body>
<div id="main">
    
    <h1 class="page-title">Client API - Class easyrtc</h1>
    
    



<section>
    
<article>    
    
    
    
    
    
    
    
    
    
    
    
        <hr/><hr/>

        <h2 class="subsection-title">Members</h2>
        
        <dl>
            
<dt>
    <h3 class="name" id=".errCodes"><span class="type-signature">&lt;static> </span>errCodes<span class="type-signature"> :Object</span></h3>
    
    
</dt>
<dd>
    
    <div class="description">
        Error codes that the EasyRTC will use in the errorCode field of error object passed
to error handler set by easyrtc.setOnError. The error codes are short printable strings.
    </div>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
</dl>

    
    
</dd>

        
            
<dt>
    <h3 class="name" id=".saveAs"><span class="type-signature">&lt;static> </span>saveAs<span class="type-signature"></span></h3>
    
    
</dt>
<dd>
    
    <div class="description">
        This is a wrapper around Eli Grey's saveAs function. This saves to the browser's downloads directory.
    </div>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
</dl>

    
    
</dd>

        </dl>
    
    
    
        <hr/><hr />
        <h2 class="subsection-title">Methods</h2>
        
        <dl>
            
<dt>
    <h3 class="name" id=".buildDragNDropRegion"><span class="type-signature">&lt;static> </span>buildDragNDropRegion<span class="signature">(droptargetName, filesHandler)</span><span class="type-signature"></span></h3>
    
    
</dt>
<dd>
    
    
    <div class="description">
        Establish an area as a drag-n-drop drop site for files.
    </div>
    

    
    
    
    
    
        <h5>Parameters:</h5>
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>droptargetName</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">DOMString</span>


            
            </td>
            
            
            
            
            
            <td class="description last">the id of the drag-and-drop site or the actual DOM object.</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>filesHandler</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>
            
            
            
            
            
            <td class="description last">function that accepts an array of File's.</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
</dl>

    
    
    
    
    
    
    
    
</dd>

        
            
<dt>
    <h3 class="name" id=".buildFileReceiver"><span class="type-signature">&lt;static> </span>buildFileReceiver<span class="signature">(acceptRejectCB, blobAcceptor, statusCB)</span><span class="type-signature"></span></h3>
    
    
</dt>
<dd>
    
    
    <div class="description">
        Enable datachannel based file receiving. The received blobs get passed to the statusCB in the 'eof' typed message.
    </div>
    

    
    
    
    
    
        <h5>Parameters:</h5>
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>acceptRejectCB</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>
            
            
            
            
            
            <td class="description last">this function is called when another peer
(otherGuy) offers to send you a list of files. this function should call it's wasAccepted function with true to
allow those files to be sent, or false to disallow them.</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>blobAcceptor</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>
            
            
            
            
            
            <td class="description last">this function is called three arguments arguments: the suppliers easyrtcid, a blob and a filename. It is responsible for
saving the blob to the file, usually using easyrtc_ft.saveAs.</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>statusCB</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">type</span>


            
            </td>
            
            
            
            
            
            <td class="description last">this function is called with the current state of file receiving. It is passed two arguments:
otherGuy - the easyrtcid of the person sending the files. *
msg - one of the following structures:
{status:"done", reason:"accept_failed"}
{status:"done", reason:"success"}
{status:"done", reason:"cancelled"}
{status:"eof"},
{status:"started_file, name:"filename"}
{status:"progress", name:filename,
   received:received_size_in_bytes,
   size:file_size_in_bytes }</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
</dl>

    
    
    
    
    
    
    
    
        <h5>Example</h5>
        
    <pre class="prettyprint"><code>easyrtc_ft(
      function(otherGuy, filenamelist, wasAccepted) {  wasAccepted(true);},
      function(otherGuy, blob, filename) { easyrtc_ft(blob, filename);},
      function(otherGuy, status) {  console.log("status:" + JSON.stringify(status))}
    );</code></pre>

    
</dd>

        
            
<dt>
    <h3 class="name" id=".buildFileSender"><span class="type-signature">&lt;static> </span>buildFileSender<span class="signature">(destUser, progressListener, options)</span><span class="type-signature"> &rarr; {function}</span></h3>
    
    
</dt>
<dd>
    
    
    <div class="description">
        Builds a function that can be used to send a group of files to a peer.
    </div>
    

    
    
    
    
    
        <h5>Parameters:</h5>
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>destUser</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>
            
            
            
            
            
            <td class="description last">easyrtcid of the person being sent to.</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>progressListener</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>
            
            
            
            
            
            <td class="description last">if provided, is called with the following objects:
   {status:"waiting"}  // once a file offer has been sent but not accepted or rejected yet
   {status:"started_file", name: filename}
   {status:"working", name:filename, position:position_in_file, size:size_of_current_file, numFiles:number_of_files_left}
   {status:"cancelled"}  // if the remote user cancels the sending
   {status:"done"}       // when the file is done
   the progressListener should always return true for normal operation, false to cancel a filetransfer.</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>options</code></td>
            
            
            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>
            
            
            
            
            
            <td class="description last">overide default file transfer settings
   maxPacketSize is the size (before base64 encoding) that is sent in a
              single data channel message, in bytes.
   maxChunkSize is the amount read from a file at a time, in bytes.
   ackThreshold is the amount of data that can be sent before an ack is
             received from the party we're sending to, bytes.
   maxChunkSize should be a multiple of maxPacketSize.
   ackThreshold should be several times larger than maxChunkSize. For
             network paths that have greater latency, increase
             ackThreshold further.</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
</dl>

    
    
    
    
    
    
    <h5>Returns:</h5>
    
            
<div class="param-desc">
    an object that accepts an array of File (the Files to be sent), and a boolean
</div>



<dl>
	<dt>
		Type
	</dt>
	<dd>
		
<span class="param-type">function</span>


	</dd>
</dl>

        
    
    
</dd>

        </dl>
    
    
    
    
    
</article>

</section>  




</div>


<br clear="both">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Fri Sep 16 2016 14:46:21 GMT-0700 (PDT)
</footer>

<script> prettyPrint(); </script>
</body>
</html>